<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Generator" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{if $page_title}{$page_title} - {/if}{if $show_site_titile eq 1}{function name='app_conf' value='SHOP_SEO_TITLE'} - {/if}{$site_info.SHOP_TITLE}</title>
<link rel="icon" href="favicon.ico" type="/image/x-icon" />
<link rel="shortcut icon" href="favicon.ico" type="/image/x-icon" />
<meta name="keywords" content="{if $page_keyword}{$page_keyword}{/if}{$site_info.SHOP_KEYWORD}" />
<meta name="description" content="{if $page_description}{$page_description}{/if}{$site_info.SHOP_DESCRIPTION}" />
<?php
$this->_var['pagecss'][] = $this->_var['TMPL_REAL']."/css/style.css";
$this->_var['pagecss'][] = $this->_var['TMPL_REAL']."/css/weebox.css";
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/jquery.js";
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/jquery.bgiframe.js";
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/jquery.weebox.js";
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/jquery.pngfix.js";
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/lazyload.js";
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/script.js";
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/op.js";
$this->_var['cpagejs'][] = $this->_var['TMPL_REAL']."/js/script.js";
$this->_var['cpagejs'][] = $this->_var['TMPL_REAL']."/js/op.js";
if(app_conf("APP_MSG_SENDER_OPEN")==1)
{
$this->_var['pagejs'][] = $this->_var['TMPL_REAL']."/js/msg_sender.js";
$this->_var['cpagejs'][] = $this->_var['TMPL_REAL']."/js/msg_sender.js";
}
$this->_var['pagecss'][] = $this->_var['TMPL_REAL']."/css/main.css";
$this->_var['pagecss'][] = $this->_var['TMPL_REAL']."/css/user_login_reg.css";
?>
<link rel="stylesheet" type="text/css" href="{function name="parse_css" v="$pagecss"}" />

<script type="text/javascript">
var APP_ROOT = '{$APP_ROOT}';;
var LOADER_IMG = '{$TMPL}/images/lazy_loading.gif';
var ERROR_IMG = '{$TMPL}/images/image_err.gif';
var send_span = {function name="app_conf" v="SEND_SPAN"}000;
{if app_conf("APP_MSG_SENDER_OPEN") eq 1 && $DEAL_MSG_COUNT > 0}
var to_send_msg = true;
{else}
var to_send_msg = false;
{/if}
</script>
<script type="text/javascript" src="{$APP_ROOT}/public/runtime/app/lang.js"></script>
<script type="text/javascript" src="{function name="parse_script" v="$pagejs" c="$cpagejs"}"></script>

<style>
	.head .head_cont .h_cont{ position:relative; }
	.head .head_top , .menu , .u_login{ display:none; }
	.no-nav-text {
				line-height: 40px;
				height: 40px;
				font-size: 25px;
				border-left: 1px solid #CCC;
				padding-left: 20px;
				margin-top: 17px;
				color: #aaa;
				position:absolute;
				left:200px;
				top:0;
				}
	.fn_top{ display:none; }

.field label{ height:40px; line-height:40px}

.hintss
{
	clear: left;
    color: #989898;
    float: left;
    font-size: 12px;
    margin-left: 90px;
    width: 300px;
}
.user-lr-box-left .field .u_icon{ left:101px; }
</style>
</head>

<body style="background: #f2f2f2;">
	<div class="head z100" id="j_head">
		<div class="head_cont" style="background:#fff">
			<div class="h_cont conbox wrap">
				<h1 class="logo">
			    	<a href="{$APP_ROOT}/">
						<?php
							$this->_var['logo_image'] = app_conf("SHOP_LOGO");
						?>
						{function name="load_page_png" v=$logo_image}
					</a>
				</h1>
				<div class="f_yahei no-nav-text">取回密码</div>
		    	<div class="menu z400">
			      	<ul>
			       	{foreach from=$nav_list item=nav_item}
					    <li {if $nav_item.current eq 1}class="currentmenu"{/if}> 
							<a href="{$nav_item.url}" target="{if $nav_item.blank eq 1}_blank{/if}" class="f_yahei">{$nav_item.name}{if $nav_item.sub_nav}<span class="arrow_down"></span>{/if}</a>
						 	{if $nav_item.sub_nav}
							<div class="menu_list z500" data-nid="has">
								<div class="menu_list_top">▲</div>
								<div class="menu_list_conten">
									<ul>
									{foreach from=$nav_item.sub_nav item=sub_item}
										<li><a href="{$sub_item.url}" target="{if $sub_item.blank eq 1}_blank{/if}" class="f_yahei">{$sub_item.name}</a></li>
									{/foreach}
									</ul>
							    </div>
							</div> 
							{/if}
						</li>
					{/foreach}       
			      	</ul>
		   		</div>
			    <div class="u_login f_r">
			    	<a>{insert name="load_user_tip"}</a>
			    </div>
			</div>
		</div>
		<p class="head_bg"></p>
	</div>
	<div class="blank20"></div>
	
	<div class="wrap inc wb" style="height:638px">
	
	
		<div class="user_inc_top">{$page_title}</div>
		<div class="inc_main pd20 clearfix">
				<div class="user-lr-box-left form f_l"  style="width: 900px;">
						
							<div class="list_title clearfix" id="J_list_select"">
								<div class="list_tt mobile list1 cur" rel="0">手机取回</div>
								<div class="list_tt email list2" rel="1">邮箱取回</div>
								
							</div>
							<div class="blank20"></div>
							<div action="{url x="shop" r="user#phone_send_password"}" name="reg_form" id="signup-user-mobile-form">
								<div class="field mobile pr">
									<div class="u_icon"></div>
									<label for="settings-mobile" class="f-label">手机号</label>
									<input type="text" value="" class="f-input ipttxt" id="settings-mobile" name="mobile" >
									<span class="f-input-tip"></span> 
									<span class="hintss pt10">请输入您绑定的手机号码</span> 
								</div>	
								<div class="blank1"></div>
								
								<div class="field verify pr" >
									<label for="settings-sms_code" class="f-label">手机验证码</label>
									<input type="text" value="" class="f-input ipttxt"  name="sms_code" id="settings-sms_code">
									<input type="button" value="获取验证码" class="sendsms_button f_l btn_disable " id="get_regsms_code" class="ml5 f_l"  />
									<span class="f-input-tip"></span>
									<span class="hintss pt10">请输入收到的手机验证码</span> 
									
								</div>
								<div class="blank1"></div>
								
								<div class="field password pr">
									<div class="u_icon"></div>
									<label for="signup-password" class="f-label">新密码</label>
									<input type="password" value="" id="signup-password" class="f-input ipttxt" name="pwd_m">
									<span class="f-input-tip"></span>
									<span class="hintss pt10">输入新密码</span> 
									<div class="blank1"></div>
								</div>
								<div class="blank1"></div>
								
								<div class="field password pr">
									<div class="u_icon"></div>
									<label for="signup-password-confirm" class="f-label">确认新密码</label>
									<input type="password" value="" id="signup-password-confirm" class="f-input ipttxt">
									<span class="f-input-tip"></span>
									<span class="hintss pt10">确认新密码</span> 
								</div>
									<div class="blank1"></div>
									
								<div class="act" style="padding-left:100px">									
									<input type="submit" value="{$LANG.RESET_PASSWORD}" id="mobile-reset-submit" class="reg-submit-btn">
								</div>
						</div>	
						
						<div action="{url x="shop" r="user#send_password"}" name="reg_form" id="signup-user-email-form" class="hide">
							
								<div class="field email pr">
									<div class="u_icon"></div>
									<label for="reset-email" class="f-label">Email</label>
									<input type="text" value="" id="reset-email" class="f-input ipttxt" name="email">
									<span class="f-input-tip"></span> 
									<span class="hintss pt10">{$LANG.RESET_EMAIL_TIP}</span> 
								</div>
								<div class="blank1"></div>
								
								<div class="field verify pr" >
									<label for="settings_eml_code" class="f-label">邮箱验证码</label>
									<input type="text" value="" class="f-input ipttxt"  name="sms_code" id="settings_eml_code">
									<input type="button" value="获取验证码" class="sendsms_button f_l btn_disable " id="get_emregsms_code" class="ml5 f_l"  />
									<span class="f-input-tip"></span>
									<span class="hintss pt10">请输入收到的邮箱验证码</span> 
									
								</div>
								<div class="blank1"></div>
								
								<div class="field password pr">
									<div class="u_icon"></div>
									<label for="signup-password" class="f-label">新密码</label>
									<input type="password" value="" id="signup-passwordss" class="f-input ipttxt" name="pwd_m">
									<span class="f-input-tip"></span>
									<span class="hintss pt10">输入新密码</span> 
									<div class="blank1"></div>
								</div>
								<div class="blank1"></div>
								
								<div class="field password pr">
									<div class="u_icon"></div>
									<label for="signup-password-confirmss" class="f-label">确认新密码</label>
									<input type="password" value="" id="signup-password-confirmss" class="f-input ipttxt">
									<span class="f-input-tip"></span>
									<span class="hintss pt10">确认新密码</span> 
								</div>
									<div class="blank1"></div>
								
								<div class="act"  style="padding-left:100px">									
									<input type="submit" value="{$LANG.RESET_PASSWORD}" id="email-reset-submit" class="reg-submit-btn">
								</div>
								
						</div>	
						
						
						
						
				</div>				
		</div><!--end inc_main-->		
		<div class="inc_foot"></div>
		
		
	</div>
	{include file="inc/footer.html"}

<script type="text/javascript">

var regsiter_vy_time = null;  	//定义时间
var is_lock_send_vy = false;	//解除锁定
var left_rg_time = 0;			//开始时间

function left_time_to_send_regvy(){
	clearTimeout(regsiter_vy_time);
	if(left_rg_time > 0){
		regsiter_vy_time = setTimeout(left_time_to_send_regvy,1000);
		$("#get_regsms_code").val(left_rg_time+"秒后重新获取验证码");
		$("#get_regsms_code").addClass("btn_disable");
		left_rg_time -- ;
	}
	else{
		is_lock_send_vy = false;
		$("#get_regsms_code").removeClass("btn_disable");
		$("#get_regsms_code").val("重新获取验证码");
		left_rg_time = 0;
	}
}



var regsiter_vy_times = null;  	//定义时间
var is_lock_send_vys = false;	//解除锁定
var left_rg_times = 0;			//开始时间
function left_time_to_send_regvys(){
	clearTimeout(regsiter_vy_times);
	if(left_rg_times > 0){
		regsiter_vy_times = setTimeout(left_time_to_send_regvys,1000);
		$("#get_emregsms_code").val(left_rg_times+"秒后重新获取验证码");
		$("#get_emregsms_code").addClass("btn_disable");
		left_rg_times -- ;
	}
	else{
		is_lock_send_vys = false;
		$("#get_emregsms_code").removeClass("btn_disable");
		$("#get_emregsms_code").val("重新获取验证码");
		left_rg_times = 0;
	}
}

$(document).ready(function(){

	//获取手机验证码
	$("#get_regsms_code").click(function(){
			if(is_lock_send_vy || $(this).hasClass(".btn_disable")){
				return false;
			}
			is_lock_send_vy = true;
		
			if(!$.maxLength($("#settings-mobile").val(),11,true))
			{
				is_lock_send_vy = false;
				formError($("#settings-mobile"),"长度不能超过11位");
				return false;
			}
			
			if($.trim($("#settings-mobile").val()).length == 0)
			{			
				is_lock_send_vy = false;
				formError($("#settings-mobile"),"{function name="sprintf" format=$LANG.EMPTY_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");
				return false;
			}	
			
			if(!$.checkMobilePhone($("#settings-mobile").val()))
			{
				is_lock_send_vy = false;
				formError($("#settings-mobile"),"{function name="sprintf" format=$LANG.FORMAT_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");	
				return false;
			}	
			var ajaxurl = APP_ROOT+"/index.php?ctl=ajax&act=get_re_pwd_verify_code";
			var query = new Object();
			query.user_mobile =  $.trim($("#settings-mobile").val());
			$.ajax({ 
				url: ajaxurl,
				data:query,
				type: "POST",
				dataType: "json",
				success: function(result){
					if(result.status==1)
					{
						left_rg_time = 60;
						left_time_to_send_regvy();
						$.showSuccess(result.info,function(){
							to_send_msg = true;
						});
					}
					else
					{	
						is_lock_send_vy = false;
						formError($("#settings-mobile"),result.info);
						return false;
					}
				},error:function(){
					is_lock_send_vy = false;
				}
			});	
	}); 

	//获取邮箱验证码
	$("#get_emregsms_code").click(function(){
			if(is_lock_send_vys || $(this).hasClass(".btn_disable")){
				return false;
			}
			is_lock_send_vys = true;
		
			var ajaxurl = APP_ROOT+"/index.php?ctl=ajax&act=get_email_verifyss";
			var query = new Object();
			query.user_email =  $.trim($("#reset-email").val());
			$.ajax({ 
				url: ajaxurl,
				data:query,
				type: "POST",
				dataType: "json",
				success: function(result){
					if(result.status==1)
					{
						left_rg_times = 60;
						left_time_to_send_regvys();
						to_send_msg = true;
						$.showSuccess(result.info);
					}
					else
					{	
						is_lock_send_vys = false;
						formError($("#reset-email"),result.info);
						return false;
					}
				},error:function(){
					is_lock_send_vys = false;
				}
			});	
	}); 
	
	
	
	
	//选项卡
	$("#J_list_select .list_tt").click(function(){
		var rel=$(this).attr("rel");
		$(this).addClass("cur");
		$("#J_list_select .list_tt[rel!='"+rel+"']").removeClass("cur");
		switch(parseInt(rel)){
			case 0:
				$("#signup-user-mobile-form").removeClass("hide");
				$("#signup-user-email-form").addClass("hide");
				break;
			case 1:
				$("#signup-user-mobile-form").addClass("hide");
				$("#signup-user-email-form").removeClass("hide");
				break;
		}
	
	});
	
	
	
	//手机验证
	$("#settings-mobile").bind("blur",function(){
		var obj = $(this);
		$("#get_regsms_code").addClass("btn_disable");
		
		if(!$.checkMobilePhone(obj.val()))
		{
			formError(obj,"{function name="sprintf" format=$LANG.FORMAT_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");	//格式错误
			return false;
		}	

		
		if($.trim(obj.val()).length == 0)
		{				
			formError(obj,"{function name="sprintf" format=$LANG.EMPTY_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");//不能为空
			return false;
		}
			
		var ajaxurl = APP_ROOT+"/index.php?ctl=ajax&act=mobile_get_pwd_check_field";
		var query = new Object();
		query.user_mobile = $.trim(obj.val());
		$.ajax({ 
			url: ajaxurl,
			data:query,
			type: "POST",
			dataType: "json",
			success: function(data){
				if(data.status==1)
				{
					if(query.field_data!='')
					formSuccess(obj,"{$LANG.VERIFY_SUCCESS}");  //验证正确
					else
					formSuccess(obj,"");
					
					$("#get_regsms_code").removeClass("btn_disable");
					return false;
				}
				else
				{					
					formError(obj,data.info);
					return false;
				}
			}
		});	
	}); 
	
	//邮箱验证
	$("#reset-email").bind("blur",function(){
		var obj = $(this);
		$("#get_emregsms_code").addClass("btn_disable");
			
		var ajaxurl = APP_ROOT+"/index.php?ctl=ajax&act=email_get_pwd_check_field";
		var query = new Object();
		query.user_email = $.trim(obj.val());
		$.ajax({ 
			url: ajaxurl,
			data:query,
			type: "POST",
			dataType: "json",
			success: function(data){
				if(data.status==1)
				{
					if(query.field_data!='')
					formSuccess(obj,"{$LANG.VERIFY_SUCCESS}");  //验证正确
					else
					formSuccess(obj,"");
					
					$("#get_emregsms_code").removeClass("btn_disable");
					return false;
				}
				else
				{					
					formError(obj,data.info);
					return false;
				}
			}
		});	
	});
	
	
	
	$("#signup-user-mobile-form #signup-password-confirm").bind("blur",function(){
		var obj = $(this);
		if(obj.val()!==""){
			if(obj.val() != obj.parent().parent().find("#signup-password").val())
			{
				formError(obj,"{$LANG.USER_PWD_CONFIRM_ERROR}");			
				return false;
			}
		}
		else{
			formError(obj,"请输入确认密码");
			return false;
		}
		formSuccess(obj,"{$LANG.VERIFY_SUCCESS}");
	}); //确认密码验证
	
	$("#signup-user-mobile-form #signup-password,#signup-user-email-form #signup-password").bind("blur",function(){
		var obj = $(this);
		var name;
		name=$.trim(obj.val())
		var reg=/^[a-zA-z0-9]{6,}$/;  
		var regs=/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/;
		if(reg.test(name)){	
			if(regs.test(name)){	
				formSuccess(obj,"{$LANG.CAN_USED}");
			}
			else{
				formError(obj,"安全等级低，请用数字+字母");
				return false;
			}
		}
		else{
			formError(obj,"长度在6~18之间，只能包含字符、数字和下划线。");
			return false;
		}
		
	}); //密码验证
	
	
	
	$("#mobile-reset-submit").click(function(){
		if(!$.checkMobilePhone($("#settings-mobile").val()))
		{
			formError($("#settings-mobile"),"{function name="sprintf" format=$LANG.FORMAT_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");	//格式错误
			return false;
		}	

		
		if($.trim($("#settings-mobile").val()).length == 0)
		{				
			formError($("#settings-mobile"),"{function name="sprintf" format=$LANG.EMPTY_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");//不能为空
			return false;
		}
		
		formSuccess($("#settings-mobile"),"{$LANG.VERIFY_SUCCESS}");
		
		if($.trim($("#settings-sms_code").val()).length == 0)
		{				
			formError($("#settings-sms_code"),"请输入验证码");//不能为空
			return false;
		}
		
		formSuccess($("#settings-sms_code"),"{$LANG.VERIFY_SUCCESS}");
		
		if($.trim($("#signup-password").val()).length == 0)
		{				
			formError($("#signup-password"),"请输入密码");//不能为空
			return false;
		}
		else{
			formSuccess($("#signup-password"),"{$LANG.VERIFY_SUCCESS}");
		}
		
		var obj = $("#signup-password-confirm");
		if(obj.val()!==""){
			if(obj.val() != obj.parent().parent().find("#signup-password").val())
			{
				formError(obj,"{$LANG.USER_PWD_CONFIRM_ERROR}");			
				return false;
			}
		}
		else{
			formError(obj,"请输入确认密码");
			return false;
		}
		formSuccess(obj,"{$LANG.VERIFY_SUCCESS}");
		
		var query = new Object();
		query.mobile = $("#settings-mobile").val();
		query.sms_code = $("#settings-sms_code").val();
		query.pwd_m = $("#signup-password").val();
		
		$.ajax({
			url:$("#signup-user-mobile-form").attr("action"),
			data:query,
			type:"post",
			dataType:"json",
			success:function(result){
				if(result.status == 1){
					$.showSuccess(result.info,function(){
						window.location.href="{url x="index" r="user#login"}";
					});
				}
				else{
					$.showErr(result.info);
				}
			}
			,error:function(){
				$.showErr("请求失败");
			}
		});
		
	});
	
	
	
	$("#email-reset-submit").click(function(){
		
		if($.trim($("#reset-email").val()).length == 0)
		{				
			formError($("#reset-email"),"{function name="sprintf" format=$LANG.EMPTY_ERROR_TIP value=$LANG.USER_TITLE_MOBILE}");//不能为空
			return false;
		}
		formSuccess($("#reset-email"),"{$LANG.VERIFY_SUCCESS}");
		
		
		if($.trim($("#settings_eml_code").val()).length == 0)
		{				
			formError($("#settings_eml_code"),"请输入验证码");//不能为空
			return false;
		}
		formSuccess($("#settings_eml_code"),"{$LANG.VERIFY_SUCCESS}");
		
		
		if($.trim($("#signup-passwordss").val()).length == 0)
		{				
			formError($("#signup-passwordss"),"请输入密码");//不能为空
			return false;
		}
		else{
			formSuccess($("#signup-passwordss"),"{$LANG.VERIFY_SUCCESS}");
		}
		
		
		var obj = $("#signup-password-confirmss");
		if(obj.val()!==""){
			if(obj.val() != obj.parent().parent().find("#signup-passwordss").val())
			{
				formError(obj,"{$LANG.USER_PWD_CONFIRM_ERROR}");			
				return false;
			}
		}
		else{
			formError(obj,"请输入确认密码");
			return false;
		}
		formSuccess(obj,"{$LANG.VERIFY_SUCCESS}");
		
		
		var query = new Object();
		query.email = $("#reset-email").val();
		query.sms_codes = $("#settings_eml_code").val();
		query.pwd_m = $("#signup-passwordss").val();
		
		$.ajax({
			url:$("#signup-user-email-form").attr("action"),
			data:query,
			type:"post",
			dataType:"json",
			success:function(result){
				if(result.status == 1){
					$.showSuccess(result.info,function(){
						window.location.href="{url x="index" r="user#login"}";
					});
				}
				else{
					$.showErr(result.info);
				}
			}
			,error:function(){
				$.showErr("请求失败");
			}
		});
		
	});
	
	
	
});
	
	
	

</script>	
	
